// 云函数入口文件
const cloud = require('wx-server-sdk')
const rq = require('request-promise') // 引入nodeJS的框架

cloud.init()

// 云函数入口函数
exports.main = async (event, context) => {
  console.log(event)
  let res = rq("https://api.douban.com/v2/book/isbn/" + event.isbn).then( html => {
    return html
  }).catch( err => {
    console.log('豆瓣API请求出错')
    console.log(err)
  })
  return res
}